<template>
    <!-- 设置垂直间距 -->
    <van-row>
        <van-col span="6">
            <van-sidebar v-model="active">
                <van-sidebar-item v-for="item in fldata" :title="item.cat_name" />
            </van-sidebar>

        </van-col>
        <van-col span="18">
            <div v-for="item in fldata[active]?.children">
                <h4>{{ item.cat_name }}</h4>
                <router-link :to="'/goods/'+item.cat_name">
                    <van-grid>
                        <van-grid-item v-for="items in item.children" :icon="items.cat_icon" :text="item.cat_name" />
                    </van-grid>
                </router-link>
            </div>
        </van-col>
    </van-row>

</template>

<script setup>
import { ref } from "vue";
import { categoriesApi } from '@/api/api'
let fldata = ref([])
const active = ref(0);
categoriesApi().then(res => {
    console.log('分类数据', res);
    fldata.value = res.data.message
})
</script>

<style lang="scss" scoped></style>